07c5411721b7d50eea2a8f86538d6e762f2f416b,sulky-formatting/src/main/java/de/huxhorn/sulky/formatting/SafeString.java,SafeString,recursiveAppend,#Object#StringBuilder#Set#,134
Before Change
if(o instanceof Map)
{
// special handling of container Map
String id = identityToString(o);
if(dejaVu.contains(id))
{
str.append(RECURSION_PREFIX).append(id).append(RECURSION_SUFFIX);
return;
}
dejaVu.add(id);
Map<?, ?> oMap = (Map<?, ?>) o;
str.append("{");
boolean first = true;
After Change
// special handling of container Object[]
if(dejaVu.containsKey(o))
{
str.append(RECURSION_PREFIX).append(identityToString(o)).append(RECURSION_SUFFIX);
return;
}
dejaVu.put(o, null);
Object[] oArray = (Object[]) o;
str.append(CONTAINER_PREFIX);
boolean first = true;
for(Object current : oArray)
{
if(first)
{
first = false;
}
else
{
str.append(CONTAINER_SEPARATOR);
}
recursiveAppend(current, str, new IdentityHashMap<>(dejaVu));
}
str.append(CONTAINER_SUFFIX);
return;
}
if(o instanceof Map)
{
// special handling of container Map
if(dejaVu.containsKey(o))
{
str.append(RECURSION_PREFIX).append(identityToString(o)).append(RECURSION_SUFFIX);
return;
}
dejaVu.put(o, null);
Map<?, ?> oMap = (Map<?, ?>) o;
str.append("{");
boolean first = true;
for(Map.Entry<?, ?> current : oMap.entrySet())
{
if(first)
{
first = false;
}
else
{
str.append(CONTAINER_SEPARATOR);
}
Object key = current.getKey();
Object value = current.getValue();
recursiveAppend(key, str, new IdentityHashMap<>(dejaVu));
str.append(KEY_VALUE_SEPARATOR);
recursiveAppend(value, str, new IdentityHashMap<>(dejaVu));
}
str.append("}");
return;
}
if(o instanceof Collection)
{
// special handling of container Collection
if(dejaVu.containsKey(o))
{
str.append(RECURSION_PREFIX).append(identityToString(o)).append(RECURSION_SUFFIX);
return;
}
dejaVu.put(o, null);
Collection<?> oCol = (Collection<?>) o;
str.append(CONTAINER_PREFIX);